package com.baymax.test.scene.life

import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner

object LifeLogger : DefaultLifecycleObserver {

    override fun onCreate(owner: LifecycleOwner) {
        super.onCreate(owner)
        println("onCreate $owner")
    }

    override fun onStart(owner: LifecycleOwner) {
        super.onStart(owner)
        println("onStart $owner")
    }

    override fun onResume(owner: LifecycleOwner) {
        super.onResume(owner)
        println("onResume $owner")
    }

    override fun onPause(owner: LifecycleOwner) {
        super.onPause(owner)
        println("onPause $owner")
    }

    override fun onStop(owner: LifecycleOwner) {
        super.onStop(owner)
        println("onStop $owner")
    }

    override fun onDestroy(owner: LifecycleOwner) {
        super.onDestroy(owner)
        println("onDestroy $owner")
        owner.lifecycle.removeObserver(this)

    }
}